/**
 * @typedef DeleteIdsBody
 * @property {string[]} ids.required
 */

const express = require('express')
const router = express.Router()
const auth = require('@/middleware/auth.middleware')
const loginLogController = require('@/controllers/login_log.controller')

/**
 * 登录日志列表分页查询
 * @route GET /loginlog
 * @summary 登录日志列表分页查询
 * @group 登录日志管理
 * @param {string} pageNo.query.required
 * @param {string} pageSize.query.required
 * @param {string} searchKeywords.query
 * @param {string} ip.query
 * @param {string} loginType.query
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @access login-log-permission:menu
 * @security JWT
 */
router.get('/', auth(), loginLogController.findPage)

/**
 * 登录日志列表批量删除
 * @route DELETE /loginlog
 * @summary 登录日志列表批量删除
 * @group 登录日志管理
 * @param {DeleteIdsBody.model} DeleteIdsBody.body.required
 * @returns {object} 200
 * @returns {Error}  default - Unexpected error
 * @security JWT
 */
router.delete('/', auth(), loginLogController.batchDelete)

module.exports = router
